﻿using MyCode.Project.Infrastructure.Enumeration;
using System;

namespace MyCode.Project.Services
{
    public interface IWorkProcessService
    {
        /// <summary>
        /// 添加调度任务
        /// </summary>
        /// <typeparam name="T">执行类</typeparam>
        /// <param name="merchantId">商家ID</param>
        /// <param name="methodName">方法名</param>
        /// <param name="remark">备注</param>
        /// <param name="entity">参数信息</param>
        /// <param name="funcType">执行类型</param>
        void Add<T>(Guid merchantId, string methodName, string remark = "", object entity = null, int priority = 5, FuncType funcType = FuncType.Method) where T : class;

        /// <summary>
        /// 添加调度任务
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <param name="type">执行类</param>
        /// <param name="methodName">方法名</param>
        /// <param name="remark">备注</param>
        /// <param name="entity">参数信息</param>
        /// <param name="funcType">执行类型</param>
        void Add(Guid merchantId, Type type, string methodName, string remark = "", object entity = null,
            FuncType funcType = FuncType.Method, int priority = 5);

        /// <summary>
        /// 添加调度任务
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <param name="typePath">类型路径，如：Lxm.IServices.IWorkProcessService, Lxm.Services</param>
        /// <param name="methodName">方法名</param>
        /// <param name="remark">备注</param>
        /// <param name="paramInfo">参数信息</param>
        /// <param name="funcType">执行类型</param>
        void Add(Guid merchantId, string typePath, string methodName, string remark = "", string paramInfo = "",
            FuncType funcType = FuncType.Method, int priority = 5);

        /// <summary>
        /// 执行，每次执行10条数据
        /// </summary>
        void Execute();

        /// <summary>
        /// 重启失败调度
        /// </summary>
		void RestratStopProcess();

        /// <summary>
        /// 重新启用某个暂停了的调度
        /// </summary>
        /// <param name="workprocessId"></param>
        void RestartStopProcess(Guid workprocessId);

        /// <summary>
        /// 调度执行优先级比较低的任务
        /// </summary>
        void ExecuteOther();

        /// <summary>
        /// 调度执行优先级等于2的任务
        /// </summary>
        void ExecutePriority2Work();

        /// <summary>
        /// 调度执行优先级=6的任务
        /// </summary>
        void ExecutePriority6();
    }
}
